#pragma once

/*
 * File - inudev_ros_nodelet.h
 *
 * This file is part of the Inuitive SDK
 *
 * Copyright (C) 2014-2020 Inuitive All Rights Reserved
 *
 */

#include "ros_sensor.h"

#include <dynamic_reconfigure/server.h>
#include <inudev_ros_nodelet/inudev_ros_nodeletConfig.h>

/**
 * \file inudev_ros_nodelet.h
 *
 * \brief ROS nodelet class
 */

namespace __INUROS__NAMESPACE__
{
    /**
     * \brief ROS inudev_ros_nodelet Nodelet
     */
    class CInuDevRosNodelet : public nodelet::Nodelet
    {
        ros::NodeHandle privNh;
        ros::NodeHandle node;

        std::shared_ptr<dynamic_reconfigure::Server<inudev_ros_nodelet::inudev_ros_nodeletConfig>> server;

        std::shared_ptr<CRosSensor> mRosSensor;

        float fps;

        virtual void onInit() override;

        void callback(inudev_ros_nodelet::inudev_ros_nodeletConfig &newConfig, uint32_t level);

    public:

        /**
         * \brief Nodelet configuration
         *
         * Holds the nodelet's dynamic configuration.
         */
        static inudev_ros_nodelet::inudev_ros_nodeletConfig config;

        /**
         * \brief Control inudev_ros_nodelet verbosity
         *
         * If non-zero, inudev_ros_nodelet will emit info related to frames received by callbacks
         */
        static int mVerbose;

#if POINTCLOUD_DUMP_FRAME
        /**
         * \brief mLogPointcloud
         *
         * If non-zero, will log point cloud data to /tmp/InuROS_PointCloud_* files.
         */
        static int mLogPointcloud;
#endif

        /**
         * \brief Get configuration object
         *
         * \return Reference for inudev_ros_nodeleteConfig object
         */
        const inudev_ros_nodelet::inudev_ros_nodeletConfig& getConfig()
        {
            return config;
        }

        CInuDevRosNodelet();
        virtual ~CInuDevRosNodelet();
    };
}
